<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY copy "&#169;">
  <!ENTITY nbsp "&#160;">
  <!ENTITY laquo "&#171;">
  <!ENTITY raquo "&#187;">
]>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">


  <xsl:include href="../layout.xsl"/>

  <xsl:template match="/">
    <xsl:apply-templates />
  </xsl:template>

  <xsl:template match="content">
    <script type="text/javascript" src="/js/struct.js"></script>

    <script type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript" src="/js/tiny_mce/tiny_config.js"></script>
    
    <link href="/js/swfupload/default.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/js/swfupload/swfupload.js"></script>
    <script type="text/javascript" src="/js/swfupload/form/fileprogress.js"></script>
    <script type="text/javascript" src="/js/swfupload/form/handlers.js"></script>
    <script type="text/javascript" src="/js/swfupload/form/config.js"></script>

    <link href="/js/jquery-autocomplete/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
    <link href="/js/jquery-autocomplete/lib/thickbox.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/js/jquery-autocomplete/lib/jquery.ajaxQueue.js"></script>
    <script type="text/javascript" src="/js/jquery-autocomplete/lib/jquery.bgiframe.min.js"></script>
    <script type="text/javascript" src="/js/jquery-autocomplete/lib/thickbox-compressed.js"></script>
    <script type="text/javascript" src="/js/jquery-autocomplete/jquery.autocomplete.min.js"></script>
    <script type="text/javascript" src="/js/jquery-autocomplete/config.js"></script>


    <script type="text/javascript" src="/js/roles.js"></script>

    <script type="text/javascript" src="/js/jquery.scrollTo/jquery.scrollTo-min.js"></script>


    <input type="hidden" id="id" value="{$Form/id}" rel="id_cat"/>
    <input type="hidden" id="upload_url" value="/{$Controller}/uploadphotos/id/{$Form/id}/f/id_cat"/>

    <div class="contenthead">
      <xsl:call-template name="Create_Path"/>

      <div class="top">
        <span class="title">
          Редактор
        </span>

      </div>
    </div>

   <xsl:call-template name="Lang" />
    <form action="" method="post" name="form" id="form" enctype="multipart/form-data">
      <!-- Right Panel -->
      <div class="aside">

        <xsl:call-template name="Box-Avatar" />

        <div class="head-slide on">
          Системные настройки
        </div>

        <div class="container">
          <ul class="editlist">
            <xsl:if test="$User/role_id = 1">
              <li>
                <label>Site</label>
                <input name="site" type="text" value="{Main/form/site}" class="broad100"/>
              </li>
              <li>
                <label>Module</label>
                <input name="_module" type="text" value="{Main/form/module}" class="broad100"/>
              </li>

              <li>
                <label>Controller</label>
                <input name="_controller" type="text" value="{Main/form/controller}" class="broad100"/>
              </li>
            </xsl:if>
            <li>
              <label>URL</label>
              <input name="url" type="text" value="{Main/form/url}" class="broad100" id="url">
                <xsl:if test="$User/role_id != 1">
                  <xsl:attribute name="disabled">disabled</xsl:attribute>
                </xsl:if>
              </input>
            </li>
            <li>
              <label>
                ID Title (<a href="javascript:;" onclick="refreshIDT({$Main/@id}, '{$Controller}')">Генерировать из названия меню</a>)
              </label>

              <input name="idt" type="text" value="{$Form/idt}" class="broad100" id="idt"/>

              <ul>
                <li>
                  <input type="checkbox" value="1" id="url_childs" checked="checked">Обновить дочерние ветки</input>
                </li>
                <li>
                  <input type="button" value="Обновить URL" onclick="refreshURL({$Main/@id})"/>
                </li>
              </ul>

            </li>


          </ul>
        </div>


        <xsl:call-template name="Box-CEO" />



        <div class="head-slide on">
          Настройки
        </div>
        <div class="container">
          <fieldset>
            <ul class="editlist">
              <li>
                <label>Тип данных в категории</label>
                <select name="id_type" id="id_type">
                  <xsl:for-each select="$Form/id_type/row">
                    <option value="{id}">
                      <xsl:if test="@active">
                        <xsl:attribute name="selected">selected</xsl:attribute>
                      </xsl:if>
                      <xsl:value-of select="name" />
                    </option>
                  </xsl:for-each>
                </select>
              </li>
              <li>
                <label>Тип Меню</label>
                <xsl:text> </xsl:text>
                <select name="id_menu" id="id_menu">
                  <option value="0">Это не меню</option>
                  <xsl:for-each select="$Form/id_menu/row">
                    <option value="{id}">
                      <xsl:if test="@active">
                        <xsl:attribute name="selected">selected</xsl:attribute>
                      </xsl:if>
                      <xsl:value-of select="name" />
                    </option>
                  </xsl:for-each>
                </select>
              </li>

              <li>
                <label>Атрибуты:</label>
                <ul>
                  <li>
                    <input type="checkbox" name="is_active" value="1">
                      <xsl:if test="$Form/is_active = 1">
                        <xsl:attribute name="checked">checked</xsl:attribute>
                      </xsl:if>
                    </input> Активная категория
                  </li>
                  <li>

                    <input type="checkbox" name="is_show" value="1">
                      <xsl:if test="$Form/is_show = 1">
                        <xsl:attribute name="checked">checked</xsl:attribute>
                      </xsl:if>
                    </input> Показывать раздел
                  </li>
                </ul>
              </li>

              <li>
                <label>Фотографии</label>

                <div class="small">
                  <input type="checkbox" name="is_show_gallery" value="1">
                    <xsl:if test="$Form/is_show_gallery = 1">
                      <xsl:attribute name="checked">checked</xsl:attribute>
                    </xsl:if>
                    Показывать фотографии в виде галереи
                  </input>
                </div>
              </li>




            </ul>
          </fieldset>




        </div>

        <xsl:if test="$User/role_id = 1">

          <div class="head-slide on">
            Права доступа
          </div>

          <div class="container">

            <fieldset>
              <select name="id_role" id="id_role" size="5" multiple="multiple" class="broad100">
                <xsl:for-each select="$Form/id_role/row">
                  <option value="{role_id}">
                    <xsl:value-of select="name_full"/>
                  </option>
                </xsl:for-each>
              </select>
            </fieldset>
            <div style="text-align:right">
              <input name="add_role" type="button" value="Добавить..."  onclick="showRoles({$Main/@id})"/>
              <input name="remove_role" id="remove_role" type="button" value="Удалить" disabled="disabled" />
            </div>

            <div id="rules_loader" style="display:none;">
              <img src="{$Images}/loader.gif"/>
            </div>

            <div class="rules" style="display: none" id="rules">
              <div class="rules_head" >
                <table width="100%" cellpadding="0" border="0" cellspacing="5">
                  <tr>
                    <td width="40%">Разрешения для</td>
                    <td align="center">Резрешить</td>
                    <td align="center">Запретить</td>
                  </tr>
                </table>
              </div>

              <div class="rules_list" id="rules_list">
                <table width="100%" cellpadding="0" border="0" cellspacing="5">
                  <tr>
                    <td width="40%">Полный доступ</td>
                    <td align="center">
                      <input name="rules_all_allow" type="checkbox" value="-1" id="rules_all_allow" class="allow"/>
                    </td>
                    <td align="center">
                      <input name="rules_all_deny" type="checkbox" value="-1"  id="rules_all_deny" class="deny"/>
                    </td>
                  </tr>
                  <xsl:for-each select="$Main/Privilege/row">
                    <tr id="priv{id}">
                      <td width="40%">
                        <xsl:value-of select="name_full"/>
                      </td>
                      <td align="center">
                        <input name="allow" type="checkbox" value="{id}" id="rules_{name}_allow" class="allow"/>
                      </td>
                      <td align="center">
                        <input name="deny" type="checkbox" value="{id}"  id="rules_{name}_deny" class="deny" />
                      </td>
                      <td align="center">
                        <xsl:if test="id_cat &gt; 0">
                          <a href="javascript:;" onclick="removePriv({id})">
                            <img src="{$Images}/cross.png"/>
                          </a>
                        </xsl:if>
                      </td>
                    </tr>
                  </xsl:for-each>
                </table>
              </div>
              <br class="spacer"/>
              <div style="text-align:right">
                <div id="rules_apply_loader" style="display:none; float: left;">
                  <img src="{$Images}/loader.gif"/>
                </div>
                <input name="add_rule" id="add_rule" type="button" value="Добавить..." onclick="showAddRule()" />
                <input name="apply_rule" id="apply_rule" type="button" value="Применить" disabled="disabled" />
              </div>
            </div>

          </div>

        </xsl:if>


      </div>

      <div class="article">



        <xsl:call-template name="Article-edit-switcher">
          <xsl:with-param name="active">1</xsl:with-param>
        </xsl:call-template>

        <xsl:call-template name="Messages"/>

        <fieldset>

          <!-- Русский -->
          <div id="page_1" style="display: block" class="page">
            <ul class="editlist">
              <li>
                <label>Название в Меню</label>
                <input name="menu_name_ru" type="text" value="{Main/form/menu_name_ru}" class="broad100" id="menu_title"/>

              </li>

              <li>
                <label>Заголовок страницы</label>

                <input name="title_ru" type="text" id="title" value="{Main/form/title_ru}" class="broad100"/>

              </li>

              <li>
                <label>Описание</label>

                <textarea name="desc_ru" class="broad100" rows="5">
                  <xsl:value-of select="Main/form/desc_ru"/>
                </textarea>

              </li>

              <li>
                <label>Текст</label>

                <textarea name="text_ru" id="body" class="broad100">
                  <xsl:value-of select="Main/form/text_ru"/>
                </textarea>

              </li>

              <li>
                <label>CEO</label>

                <textarea name="ceo_ru" id="body3" class="broad100">
                  <xsl:value-of select="Main/form/ceo_ru"/>
                </textarea>

              </li>
            </ul>
          </div>
        </fieldset>
        <!-- Украинский -->
        <div id="page_2" style="display: none" class="page">
          <fieldset>
            <ul class="editlist">
              <li>
                <label>Название в Меню</label>

                <input name="menu_name_ua" type="text"   value="{Main/form/menu_name_ua}" class="broad100"/>

              </li>

              <li>
                <label>Заголовок страницы</label>

                <input name="title_ua" type="text" id="title" value="{Main/form/title_ua}" class="broad100"/>

              </li>

              <li>
                <label>Описание</label>

                <textarea name="desc_ua" class="broad100" rows="5">
                  <xsl:value-of select="Main/form/desc_ua"/>
                </textarea>

              </li>

              <li>
                <label>Текст</label>

                <textarea name="text_ua" id="body1" class="broad100">
                  <xsl:value-of select="Main/form/text_ua"/>
                </textarea>

              </li>

              <li>
                <label>CEO</label>

                <textarea name="ceo_ua" id="body4" class="broad100">
                  <xsl:value-of select="Main/form/ceo_ua"/>
                </textarea>

              </li>

              <li>
                <label>Title</label>
                <textarea name="ceo_title_ua" class="broad100">
                  <xsl:value-of select="Main/form/ceo_title_ua"/>
                </textarea>
              </li>
              <li>
                <label>META Description</label>
                <textarea name="ceo_keywords_ua" class="broad100">
                  <xsl:value-of select="Main/form/ceo_keywords_ua"/>
                </textarea>
              </li>
              <li>
                <label>META Keywords (через запятую)</label>
                <textarea name="ceo_desc_ua" class="broad100">
                  <xsl:value-of select="Main/form/ceo_desc_ua"/>
                </textarea>
              </li>
            </ul>
          </fieldset>
        </div>
        <!-- Английский -->
        <div id="page_3" style="display: none" class="page">
          <fieldset>
            <ul class="editlist">
              <li>
                <label>Название в Меню</label>

                <input name="menu_name_en" type="text"  value="{Main/form/menu_name_en}" class="broad100"/>

              </li>

              <li>
                <label>Заголовок страницы</label>

                <input name="title_en" type="text" id="title" value="{Main/form/title_en}" class="broad100"/>

              </li>

              <li>
                <label>Описание</label>

                <textarea name="desc_en" class="broad100" rows="5">
                  <xsl:value-of select="Main/form/desc_en"/>
                </textarea>

              </li>

              <li>
                <label>Текст</label>

                <textarea name="text_en" id="body2" class="broad100">
                  <xsl:value-of select="Main/form/text_en"/>
                </textarea>

              </li>

              <li>
                <label>CEO</label>
                <textarea name="ceo_en" id="body5" class="broad100">
                  <xsl:value-of select="Main/form/ceo_en"/>
                </textarea>
              </li>             
            </ul>
          </fieldset>
        </div>

      <!--  <fieldset>
          <ul class="editlist">
            <li>
              <label>Параметры</label>
              <input name="tags" type="text" id="tags" value="{$Form/tags}" size="70" class="broad50"/>
            </li>
            <xsl:for-each select="$Form/tags_vals/row">
              <li>
                <label>
                  <xsl:value-of select="name"/>
                </label>
                <input name="tags_vals_id[]" type="hidden" value="{id}"/>
                <input name="tags_vals[]" type="text" value="{val}" size="70" class="broad50"/>
              </li>
            </xsl:for-each>
          </ul>
        </fieldset>-->







      </div>
      <div class="submitbox">
        <input name="save" type="submit" style="font-weight: bold;" value="Сохранить" />
        <input name="saveexit" type="submit" value="Сохранить и выйти" />
        <input type="button" value="Отменить" onclick="document.location = '/{$Controller}#{$Main/@id}'"/>
      </div>
    </form>



    <!--<div style="display: none; left: 30%; top: 30%;" id="layer1">
      <div style="-moz-user-select: none;" id="layer1_handle">
        <a href="#" id="close">[ x ]</a>
        Роли / Пользователи
      </div>
      <div id="layer1_content">
        <form id="dialog_form_role" method="post" action="">
          <fieldset>
            <select name="dialog_id_role" id="dialog_id_role" size="5" multiple="multiple" class="broad100">
            </select>
          </fieldset>
          <div style="text-align:right">
            <input name="dialog_add_role" type="button" value="Добавить"/>
          </div>
        </form>
      </div>
    </div>-->


    <!-- Rules List Message Box -->
    <div class="highslide-html-content" id="popup_roles">
      <div class="highslide-header">
        <ul>
          <li class="highslide-move">
          </li>
        </ul>
      </div>
      <div class="highslide-body">
        <form id="dialog_form_role" method="post" action="">
          <fieldset>
            <select name="dialog_id_role" id="dialog_id_role" size="5" multiple="multiple" class="broad100">
            </select>
          </fieldset>
          <div class="go">
            <input name="dialog_add_role" id="dialog_add_role" type="button" value="Добавить"/>
            <input type="button"  class="submit" value="Отмена" onclick="return hs.close(this)"/>
          </div>
        </form>
      </div>
    </div>

    <!-- Add Rule Box -->
    <div class="highslide-html-content" id="popup_add_rule">
      <div class="highslide-header">
        <ul>
          <li class="highslide-move">
          </li>
        </ul>
      </div>
      <div class="highslide-body">
        <form id="dialog_form_role" method="post" action="">
          <fieldset>
            <ul class="editlist">
              <li>
                <label>Имя ([имя]Action)</label>
                <input type="text" name="name" id="priv_name"/>
              </li>
              <li>
                <label>По русски</label>
                <input type="text" name="name_full" id="priv_full_name"/>
              </li>
            </ul>
          </fieldset>

          <div class="go">
            <input type="button" value="Добавить" onclick="addRule({$Main/@id}, $('#priv_name').val(), $('#priv_full_name').val())"/>
            <input type="button" class="submit" value="Отмена" onclick="return hs.close(this)"/>
          </div>
        </form>
      </div>
    </div>

  </xsl:template>

</xsl:stylesheet>